<?php


/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Badge
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
?>
<div class='layout_right badge_view_layout_right'>
  <div class='badges_gutter'>
    <div class='badge_award_badge'>
      <?php echo $this->htmlLink($this->badge->getHref(),
        $this->itemPhoto($this->badge, 'thumb.profile')
      )?>
      <?php echo $this->htmlLink($this->badge->getHref(),
        $this->badge->getTitle(),
        array('class' => 'badge_award_badge_title')
      )?>
      <div class='badge_award_meta'>
        <?php $total_members = $this->badge->countAwards(array('active'=>true));
          echo $this->translate(array('%s awarded member', '%s awarded members', $total_members), $total_members);
        ?>
      </div>
    </div>  
  
    <?php if ($this->badge->getDescription()):?>
      <div class='badge_desc'>
        <h4><?php echo $this->translate('About This Badge')?></h4>
        <div><?php echo $this->viewMore($this->badge->getDescription()); ?></div>
      </div>
    <?php endif;?>
    
    <?php if( $this->awardPaginator->getTotalItemCount() > 0 ): ?>
      <div class='badge_others'>
        <h4><?php echo $this->translate('Other Awarded Badges')?></h4>
        <ul class='badges_awards_quicklist'>
          <?php foreach ($this->awardPaginator as $award): ?>
          <li>
            <div class='badge_award_photo'>
              <?php echo $this->htmlLink($award->getHref(), 
                $this->itemPhoto($award, 'thumb.icon')
              );?>
            </div>
            <div class='badge_award_info'>
              <div class='badge_award_title'>
                <?php echo $this->htmlLink($award->getHref(),
                  $award->getBadge()->getTitle()
                )?>
              </div>
              <div class='badge_award_meta'>
                <?php echo $this->translate('Since %s', $this->locale()->toDate($award->creation_date))?>
              </div>
            </div>
          </li>  
          <?php endforeach;?>
        </ul>
        <div class="badge_quick_links">
          <?php echo $this->htmlLink(array('route'=>'badge_award_user', 'user_id'=>$this->user->getIdentity()),
            $this->translate('View all awarded badges')
          )?>
        </div>
      </div>
    <?php endif; ?>
    
  </div>
</div>

<div class='layout_middle badge_layout_middle'>
  <div class='badge_award_view'>
    <h2>
      <?php echo $this->translate('%1$s\'s Member: %2$s', $this->badge->__toString(), $this->user->__toString())?>
    </h2>
    
    <div class='badge_award'>

      <h3>
        <?php echo $this->award->getTitle(); ?>
      </h3>
      <div class='badge_award_meta'>
        <?php echo $this->translate('Awarded %1$s with %2$s badge on %3$s', 
          $this->user->__toString(),
          $this->badge->__toString(),
          $this->locale()->toDate($this->award->creation_date)
        ); ?>
          -
          <?php echo $this->translate(array("%s comment", "%s comments", $this->award->comment_count), $this->locale()->toNumber($this->award->comment_count)); ?>
          -
          <?php echo $this->translate(array('%1$s like', '%1$s likes', $this->award->like_count), $this->locale()->toNumber($this->award->like_count)); ?>
      </div>
      <div class="badge_award_desc">
      
        <div class='badge_award_user'>
          <?php echo $this->htmlLink($this->user->getHref(),
            $this->itemPhoto($this->user, 'thumb.profile')
          )?>
          <?php echo $this->htmlLink($this->user->getHref(), $this->user->getTitle(), array('class' => 'badge_award_user_title')) ?>    
        </div> 

        <?php if ($this->award->body): ?>
          <?php echo $this->award->body; ?>
        <?php else: ?>
          <?php echo nl2br($this->award->getDescription());?>
        <?php endif;?>  
      </div>
      
      <div class="badge_award_tools">
        <?php echo $this->htmlLink(Array('module'=> 'activity', 'controller' => 'index', 'action' => 'share', 'route' => 'default', 'type' => 'badge_award', 'id' => $this->award->getIdentity(), 'format' => 'smoothbox'), $this->translate("Share"), array('class' => 'smoothbox')); ?>
        &nbsp; | &nbsp;
         <?php echo $this->htmlLink(Array('module'=> 'core', 'controller' => 'report', 'action' => 'create', 'route' => 'default', 'subject' =>  $this->award->getGuid(), 'format' => 'smoothbox'), $this->translate("Report"), array('class' => 'smoothbox')); ?>
      </div>      
    </div>
    
    <?php echo $this->action("list", "comment", "core", array("type"=>"badge_award", "id"=>$this->award->getIdentity())) ?>
  </div>
</div>